import request from "@/utils/request.js";
import {API} from '@/config/app.js'

/**
 * 获取合同详情
 * @param {Object} data - 请求参数
 * @param {string} data.contractId - 合同ID
 */
export function getContractDetail(data) {
    return request.get(`${API}/client/user/contract/findContractByCode/${data.code}`);
}

/**
 * 上传签名
 * @param {Object} data - 请求参数
 */
export function uploadSignature(data) {
    return request.post(`${API}/client/user/contract/add`, data);
}

/**
 * 获取合同签署详情
 * @param {Object} data - 请求参数
 * @param {string} data.contractId - 合同签署详情
 */
export function getUserContractDetail(code) {
    return request.get(`${API}/client/user/contract/findByCode/${code}`);
}

/**
 * 获取合同签署状态
 * @param {Object} data - 请求参数
 * @param {string} data.contractId - 合同ID
 */
export function getContractStatus(data) {
    return request.get(`${API}/client/contract/status`, data);
}

/**
 * 获取课程详情
 * @param {Object} courseCode - 课程code
 */
export function getCourseDes(courseCode) {
    return request.get(`${API}/client/course/${courseCode}`,{},{noAuth:true});
}
/**
 * 获取课程章节
 * @param {Object} courseCode - 课程code
 */
export function getCourseChapter(courseCode) {
    return request.get(`${API}/client/course/chapter/${courseCode}`,{},{noAuth:true});
}
/**
 * 获取课程分享信息
 * @param {Object} courseCode - 课程code
 */
export function getCourseShare(courseCode) {
    return request.get(`${API}/client/course/share/${courseCode}`,{},{noAuth:true});
}
/**
 * 创建订单
 * @param {Object} data - 请求参数
 */
export function createOrder(data) {
    return request.post(`${API}/client/order/add`, data);
}
/**
 * 支付
 * @param {Object} data - 请求参数
 */
export function payOrder(data) {
    return request.post(`${API}/client/pay/order`, data);
}
/**
 * 领取红包
 */
export function claimRedpack(data) {
	return request.get(`${API}/client/live/redpack/receive/claim`, data);
}